package com.yiran.controller;

import com.yiran.pojo.Attendance;
import com.yiran.pojo.Result;
import com.yiran.service.AttendanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class AttendanceController {

    @Autowired
    private AttendanceService attendanceService;

    @GetMapping("attendance/add/{id}")
    public Result add(@PathVariable Long id){
        attendanceService.add(id);
        return Result.success();
    }

    /**
     * 获取员工打卡记录
     * @param id
     * @return
     */

    @GetMapping("/attendance/list/{id}")
    public Result<List<Attendance>> attendanceList(@PathVariable Integer id){
       List list= attendanceService.attendancList(id);
       return Result.success(list);
    }

}
